package com.company.easy;

import java.util.HashMap;

public class LK1791 {
    public static void main(String[] args) {
    int[][] arr = new int[1][1];
    String a = "{[[1,18],[18,2],[3,18],[18,4],[18,5],[6,18],[18,7],[18,8],[18,9],{18,10},{18,11},{12,18},{18,13},{18,14},{15,18},{16,18},{17,18}}";
        System.out.println(a);
    }
    public int findCenter(int[][] edges) {
        HashMap<Integer,Integer> map = new HashMap<>();
        for(int i = 0;i<edges.length;i++){
            if(map.containsKey(edges[i][0])){
                map.put(edges[i][0],map.get(edges[i][0])+1);
            }else{
                map.put(edges[i][0],1);
            }
            if(map.containsKey(edges[i][1])){
                map.put(edges[i][1],map.get(edges[i][1])+1);
            }else{
                map.put(edges[i][1],1);
            }
        }
        int n = edges.length;
        for(int i =1;i<=edges.length;i++){
            if(map.get(i)==n){
                return i;
            }
        }
        return 0;
    }
}
